Enhance exponential_search doctests with comprehensive examples#14286
Open
JesunAhmadUshno wants to merge 3 commits intoTheAlgorithms:masterfrom
Open
Enhance exponential_search doctests with comprehensive examples#14286JesunAhmadUshno wants to merge 3 commits intoTheAlgorithms:masterfrom
JesunAhmadUshno wants to merge 3 commits intoTheAlgorithms:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances documentation and doctest coverage around exponential_search(), and also includes a handful of broader typing/documentation cleanups in other modules.
Changes:
- Expanded
exponential_search()docstring with additional explanation, complexity notes, and 10 new doctest examples. - Migrated some type annotations to PEP 695 generic syntax (
jump_search,valid_input) and generalized bipartite graph function typing. - Minor small refactor in hash table linked-list storage (
deque([])→deque()).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
searches/jump_search.py |
Updates generic typing syntax for jump_search() and removes the old TypeVar declaration. |
searches/exponential_search.py |
Adds more explanatory docstring text and expands doctest examples from 4 to 14. |
machine_learning/linear_discriminant_analysis.py |
Updates valid_input() typing to PEP 695 generic syntax and removes TypeVar usage/import. |
graphs/check_bipatrite.py |
Broadens accepted graph typing to hashable nodes and updates docs/annotations for DFS/BFS variants. |
data_structures/hashing/hash_table_with_linked_list.py |
Minor simplification of deque construction in _set_value. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
93
to
+95
| Check if the graph can be divided into two sets of vertices, such that no two | ||
| vertices within the same set are connected by an edge. | ||
| vertices within the same set are connected by an edge. Neighbor nodes that do | ||
| not appear as keys are treated as isolated nodes with no outgoing edges. |
There was a problem hiding this comment.
Docstring says neighbor nodes not appearing as keys are treated as “isolated nodes,” but those nodes can still have incoming edges (they just have no outgoing adjacency list). Consider rewording to “treated as nodes with no outgoing edges/neighbor list” to match the behavior more precisely.
7 tasks
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enhanced doctest coverage for
exponential_search()with 14 comprehensive test examples covering:Changes
Checklist